﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class FightCharacterInfo : MonoBehaviour
{
    public FightSystem fightSystem;
    public Transform characterInfoPrefab;
    public Image firstInfo;
    public List<SingleCharacterInfo> characterInfos;
    public float infoSpacing = 20f;

    // Start is called before the first frame update
    void Start()
    {
        Vector3 position = firstInfo.transform.position;
        foreach (Character character in FightSystem.playerTeam.characters)
        {
            SingleCharacterInfo newInfo = GameObject.Instantiate(characterInfoPrefab, position, characterInfoPrefab.rotation, this.transform).GetComponent<SingleCharacterInfo>();
            characterInfos.Add(newInfo);
            newInfo.character = character;
            newInfo.Refresh();
            position.y -= infoSpacing;
        }
    }

    // Update is called once per frame
    void Update()
    {
        foreach(SingleCharacterInfo info in characterInfos)
        {
            info.Refresh();
        }
    }
}
